1. Module (scheme read)

Module (scheme read)

[procedure] (read [port])

If port is omitted from read, it defaults to the value returned by (current-input-port). It is an error to attempt an input operation on a closed port.

The read procedure converts external representations of Scheme objects into the objects themselves. That is, it is a parser for the non-terminal <datum>. It returns the next object parsable from the given textual input port, updating port to point to the first character past the end of the external representation of the object.

If an end of file is encountered in the input before any characters are found that can begin an object, then an end-of-file object is returned. The port remains open, and further attempts to read will also return an end-of-file object. If an end of file is encountered after the beginning of an object’s external representation, but the external representation is incomplete and therefore not parsable, an error that satisfies read-error? is signaled.


Previous: Module (scheme process-context)

Next: Module (scheme repl)